import requests
from config import *

class ShopApi():
    def __init__(self):
        self.shop_class_url = MAIN_URL + 'api/v1/category/all'

        self.class_info_url = MAIN_URL + 'api/v1/product/by_category?id={}'

        self.shop_info_url = MAIN_URL + 'api/v1/product/{}'
        pass
    # 商品分类界面
    def shop_class_response(self):
        url = self.shop_class_url
        return requests.get(url)
    # 分类详情
    def class_info_response(self, id_c):
        url = self.class_info_url.format(id_c)
        return requests.get(url)
    # 商品信息
    def shop_info_response(self,id_s):
        url = self.shop_info_url.format(id_s)
        return requests.get(url)

shop_api = ShopApi()